<!-- 针织梭织统计 -->
<div style="height:15px;"></div>
<div id="zz_sz"></div>

<script>
layui.use(['jquery', 'layer', 'tool'], function() {
	var $ = layui.jquery;
	var layer = layui.layer;
	
	//针织梭织统计
	window.getSkutypeStat = function() {
		$.ajax({
			type: "POST",
			url: "?c=daily&m=index",
			data: "_ajax=1&fun=_getSkutypeStat&factory_id="+factoryId+"&from="+from,
			dataType: "json",
			success: function(res){
				if(res.code == 1){
					var html = '';
					var d = res.data;
	
					html += '<table class="layui-table">';
					html += '  <tr>';
					html += '   <td width="4%">&nbsp;</td>';
					html += '   <td width="8%">&nbsp;</td>';
	
					for(var i in d.days) {
						html += '<td width="11%">'+d.days[i]+'</td>';
					}
	
					html += '    <td width="11%">最近一周合计</td>';
					html += '  </tr>';
	
					html += '  <tr>';
					html += '    <td rowspan="2">针织</td>';
					html += '    <td>最近7日下单</td>';
	
					var mm=0;
					var ii=0;
					var oo=0;
					for(var x in d.zz_orders) {
						mm = mm + layui.tool.parseFloat(d.zz_orders[x]['m']);
						ii = ii + parseInt(d.zz_orders[x]['i']);
						oo = oo + parseInt(d.zz_orders[x]['o']);
						html += '<td><span class="yuan">'+d.zz_orders[x]['m']+'</span>元/<span class="jian">'+d.zz_orders[x]['i']+'</span>件/<span class="dan">'+d.zz_orders[x]['o']+'</span>单</td>';
					}
					html += '<td><span class="yuan">'+layui.tool.parseFloat(mm)+'</span>元/<span class="jian">'+ii+'</span>件/<span class="dan">'+oo+'</span>单</td>';
					html += '  </tr>';
	
					html += '  <tr>';
					html += '<td>最近7日出货</td>';
	
					var mm=0;
					var ii=0;
					var oo=0;
					for(var x in d.zz_shipments) {
						mm = mm + layui.tool.parseFloat(d.zz_shipments[x]['m']);
						ii = ii + parseInt(d.zz_shipments[x]['i']);
						oo = oo + parseInt(d.zz_shipments[x]['o']);
						html += '<td><span class="yuan">'+d.zz_shipments[x]['m']+'</span>元/<span class="jian">'+d.zz_shipments[x]['i']+'</span>件/<span class="dan">'+d.zz_shipments[x]['o']+'</span>单</td>';
					}
					html += '<td><span class="yuan">'+layui.tool.parseFloat(mm)+'</span>元/<span class="jian">'+ii+'</span>件/<span class="dan">'+oo+'</span>单</td>';
					html += '  </tr>';
	
					html += '  </tr>';
					html += '  <tr>';
					html += '    <td rowspan="2">梭织</td>';
					html += '    <td>最近7日下单</td>';
	
					var mm=0;
					var ii=0;
					var oo=0;
					for(var x in d.sz_orders) {
						mm = mm + layui.tool.parseFloat(d.sz_orders[x]['m']);
						ii = ii + parseInt(d.sz_orders[x]['i']);
						oo = oo + parseInt(d.sz_orders[x]['o']);
						html += '<td><span class="yuan">'+d.sz_orders[x]['m']+'</span>元/<span class="jian">'+d.sz_orders[x]['i']+'</span>件/<span class="dan">'+d.sz_orders[x]['o']+'</span>单</td>';
					}
					html += '<td><span class="yuan">'+layui.tool.parseFloat(mm)+'</span>元/<span class="jian">'+ii+'</span>件/<span class="dan">'+oo+'</span>单</td>';
					html += '  </tr>';
	
					html += '  <tr>';
					html += '    <td>最近7日出货</td>';
	
					var mm=0;
					var ii=0;
					var oo=0;
					for(var x in d.sz_shipments) {
						mm = mm + layui.tool.parseFloat(d.sz_shipments[x]['m']);
						ii = ii + parseInt(d.sz_shipments[x]['i']);
						oo = oo + parseInt(d.sz_shipments[x]['o']);
						html += '<td><span class="yuan">'+d.sz_shipments[x]['m']+'</span>元/<span class="jian">'+d.sz_shipments[x]['i']+'</span>件/<span class="dan">'+d.sz_shipments[x]['o']+'</span>单</td>';
					}
					html += '<td><span class="yuan">'+layui.tool.parseFloat(mm)+'</span>元/<span class="jian">'+ii+'</span>件/<span class="dan">'+oo+'</span>单</td>';
					html += '  </tr>';
					html += '</table>';
	
					html += '<table class="layui-table" id="skutype-part2">';
					html += '<tr>';
					html += '<td width="">&nbsp;</td>';
					html += '<td width="13%">7天日均</td>';
					html += '<td width="13%">14天日均</td>';
					html += '<td width="13%">21天日均</td>';
					html += '<td width="13%">在途量</td>';
					html += '<td width="13%">压力系数</td>';
					html += '<td width="13%">上月出货</td>';
					html += '<td width="13%">本月出货</td>';
					html += '</tr>';
					html += '<tr>';
					html += '<td>针织</td>';
					html += '<td><span class="yuan">'+d.zz['day7']['m']+'</span>元/<span class="jian">'+d.zz['day7']['i']+'</span>件/<span class="dan">'+d.zz['day7']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+d.zz['day14']['m']+'</span>元/<span class="jian">'+d.zz['day14']['i']+'</span>件/<span class="dan">'+d.zz['day14']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+d.zz['day21']['m']+'</span>元/<span class="jian">'+d.zz['day21']['i']+'</span>件/<span class="dan">'+d.zz['day21']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+d.zz['ing']['m']+'</span>元/<span class="jian">'+d.zz['ing']['i']+'</span>件/<span class="dan">'+d.zz['ing']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+d.zz['pressure']['m']+'</span>元/<span class="jian">'+d.zz['pressure']['i']+'</span>件/<span class="dan">'+d.zz['pressure']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+layui.tool.parseFloat(d.zz['lastmonth_shipment']['m'], 0)+'</span>元/<span class="jian">'+d.zz['lastmonth_shipment']['i']+'</span>件/<span class="dan">'+d.zz['lastmonth_shipment']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+layui.tool.parseFloat(d.zz['thismonth_shipment']['m'], 0)+'</span>元/<span class="jian">'+d.zz['thismonth_shipment']['i']+'</span>件/<span class="dan">'+d.zz['thismonth_shipment']['o']+'</span>单</td>';
					html += '</tr>';
					html += '<tr>';
					html += '<td>梭织</td>';
					html += '<td><span class="yuan">'+d.sz['day7']['m']+'</span>元/<span class="jian">'+d.sz['day7']['i']+'</span>件/<span class="dan">'+d.sz['day7']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+d.sz['day14']['m']+'</span>元/<span class="jian">'+d.sz['day14']['i']+'</span>件/<span class="dan">'+d.sz['day14']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+d.sz['day21']['m']+'</span>元/<span class="jian">'+d.sz['day21']['i']+'</span>件/<span class="dan">'+d.sz['day21']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+d.sz['ing']['m']+'</span>元/<span class="jian">'+d.sz['ing']['i']+'</span>件/<span class="dan">'+d.sz['ing']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+d.sz['pressure']['m']+'</span>元/<span class="jian">'+d.sz['pressure']['i']+'</span>件/<span class="dan">'+d.sz['pressure']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+layui.tool.parseFloat(d.sz['lastmonth_shipment']['m'], 0)+'</span>元/<span class="jian">'+d.sz['lastmonth_shipment']['i']+'</span>件/<span class="dan">'+d.sz['lastmonth_shipment']['o']+'</span>单</td>';
					html += '<td><span class="yuan">'+layui.tool.parseFloat(d.sz['thismonth_shipment']['m'], 0)+'</span>元/<span class="jian">'+d.sz['thismonth_shipment']['i']+'</span>件/<span class="dan">'+d.sz['thismonth_shipment']['o']+'</span>单</td>';
					html += '</tr>';
					html += '</table>';
	
					$('#zz_sz').html(html);
				}else layer.msg(res.msg, {icon: 2,anim: 6});
			}
		});
	}
	
	setTimeout("getSkutypeStat()", 4000);	// 针织梭织统计
	setInterval("getSkutypeStat()", 1800000); 	// 针织梭织统计
});
</script>